package com.fuchen.shengwu.service.report.connection;

/**
 * Created by luganlin on 01/05/2018.
 */
public class ConnectionFactory {
    // todo: 统一的初始化接口: 文件，数据库类型，用户名和密码
    //refer to head first design pattern
    public static DataSourceConnection getConnection(String type, String user, String password, String database) {
        if (DataSourceType.POSTGRESQL.equals(type)) {
            return new DatabaseDataSourceConnection(DataSourceType.POSTGRESQL, user, password, database);
        }else {
            //todo: customized exceptions
            throw new RuntimeException("不支持的类型");
        }
    }
}
